package com.ccsoft.atools.controller;


import com.ccsoft.atools.model.RoadTrip;
import com.ccsoft.atools.service.RoadTripService;
import com.ccsoft.atools.utils.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName:RoadTripController
 * @Description:TODO
 * @Author:chanchaw
 * @Date:2020-01-07 12:51
 * @Version:1.0
 **/
@CrossOrigin
@RestController
@RequestMapping("/roadTrip")
public class RoadTripController {

    @Autowired
    private RoadTripService service;

    @DeleteMapping("/deleteByPrimaryKey/{iid}")
    public JsonResult deleteByPrimaryKey(@PathVariable Integer iid) {
        return JsonResult.ok(service.deleteByPrimaryKey(iid));
    }

    @PostMapping("/insert")
    public JsonResult insertSelective(@RequestBody RoadTrip record) {
        RoadTrip newRecord = service.insertSelective(record);

        return JsonResult.ok(newRecord);
    }

    @GetMapping("/selectByPrimaryKey/{iid}")
    public JsonResult selectByPrimaryKey(@PathVariable Integer iid) {
        return JsonResult.ok(service.selectByPrimaryKey(iid));
    }

    @GetMapping("/selectAll")
    public JsonResult selectAll() {
        return JsonResult.ok(service.selectAll());
    }

    @PostMapping("/update")
    public JsonResult updateByPrimaryKeySelective(@RequestBody RoadTrip record) {
        return JsonResult.ok(service.updateByPrimaryKeySelective(record));
    }


}
